﻿function DisplayDetails(homeOrDetail) {

                                                                             //call json using kpi id
    $.getJSON("http://localhost:53425/api/KPI/" + homeOrDetail + "/jsonp?callback=?", function (data) {

        $('#detailList').html('');

        var detailsOutput = "<li><h1>" + data.name + "</h1>";                                                       //populate content variable
        detailsOutput += "<h2>Current Value: " + numberToCurrency(data.currentValue) + "</h2>";
        detailsOutput += "<h2>Last Value: " + numberToCurrency(data.lastValue) + "</h2>";
        detailsOutput += "<h2>Change: " + numberToCurrency((data.currentValue - data.lastValue)) + "</h2>";
        detailsOutput += "<h2>Acceptable Range is: " + numberToCurrency(data.lowRange) + " to " + numberToCurrency(data.highRange) + "</h2></li>";

        DetailsGraph = new GraphData(data.currentValue, data.lastValue, data.lowRange, data.highRange, data.Name);

        
        $("#detailList").append(detailsOutput);                                                                      //send content to page, refresh listview as last task
        $("#detailList").listview('refresh');
        
    });
}